<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>成交清算日报表</title>
    <!--导入layui包-->
    <link rel="stylesheet" href="../layui/css/layui.css"/>
    <script src="../jQuery/jquery-1.11.2.js"></script>
    <script src="../layui/layui.js"></script>
    <link rel="stylesheet" type="text/css" href="/css/font.css">
</head>
<body>
<blockquote class="layui-elem-quote news_search">
    <!--数据表格-->
    <table class="layui-hide" id="DayStatement" lay-filter="secStockList"></table>

    <script type="text/html" id="day_search">
        <!--多条件查询层-->
        <div class="layui-inline">
            证券名称：
            <div class="layui-input-inline">
                <select name="seName" id="seName"></select>
            </div>
            <button id="search" class="layui-btn  layui-btn-primary layui-bg-gray" lay-submit data-type="reload"
                    lay-filter="provinceSearch">
                <i class="layui-icon">&#xe615;</i>
            </button>
        </div>
        <!--多条件查询结束-->
    </script>

    <!-- 行中操作按钮[仅对本行操作] -->

    <!--脚本代码-->
    <script type="text/javascript">
        layui.use(['table', 'layer', 'form', 'laypage', 'util', 'jquery'], function () {
            //导入模块并得到模块对象
            var table = layui.table,//表格对象
                layer = layui.layer,//弹层对象
                form = layui.form,//表单对象
                laypage = layui.laypage,//分页组件
                $ = layui.jquery,//jquery对象
                util = layui.util;//工具对象
            var tables;
            var vals="";
            var varseName="<option value=''>--请选择--</option>";
            //开关用于避免重复添加搜索框
            var tufa=false;
            //开关用于避免重复执行
            var tafa=true;
            var two;
            //渲染表格对象
            tables=table.render({
                //id:"houseReload",//为多条件搜索重新加载使用
                elem: "#DayStatement",//表格对象
                url: "/DayStatement/Day",//后台服务路径
                method: "get",//提交方式
                height: 1100,
                toolbar: "#day_search",//表格上方普通工具栏
                //一页显示5条数据
                limit: 5,
                cols: [
                    [
                        {checkbox: true},//开启多选框
                        {field: "seId", title: "证券代码", align: "center"},
                        {field: "seName", title: "证券名称", align: "center"},
                        {field: "tranNum", title: "成交数量（支）", align: "center"},
                        {field: "tranMoney", title: "成交金额（元）", align: "center"},
                        {field: "commRate", title: "席位佣金（元）", align: "center"},
                        {field: "staDuty", title: "印花税（元）", align: "center"},
                        {field: "handFee", title: "经手费（元）", align: "center"},
                        {field: "tranFee", title: "过户费（元）", align: "center"},
                        {field: "collFee", title: "征管费（元）", align: "center"},
                        {field: "amos", title: "实际清算款金额（元）", align: "center"},
                        {field: "tranDate", title: "交易日期", align: "center"}
                    ]
                ],parseData:function (res) {

                    //证券
                    two = res.securi;
                    var twoStr = "<option value=''>--请选择--</option>";
                    for (var i = 0; i < two.length; i++) {
                        twoStr += "<option value='" + two[i].seName + "'>" + two[i].seName + "</option>";
                    }
                    var datasTwo=new Array();
                    // var data=res.data;
                    // if(tafa!=false || res.data.length>data.length){
                    //     tafa=false;
                    //     tufa=true;
                    // // }
                    // if(tufa!=false){
                    //     for (var i = 0; i < data.length; i++) {
                    //         varseName += "<option value='" + data[i].seName + "'>" + data[i].seName + "</option>";
                    //     }
                    //     tufa=false;
                    // }
                    $("#seName").html(twoStr);
                    for (var i = 0; i <res.data.length; i++) {
                        if(vals==""){
                            datasTwo.push(res.data[i]);
                        }else if(res.data[i].seName==vals){
                            datasTwo.push(res.data[i]);
                        }
                    }
                    return {
                        "code":res.code,
                        "msg":res.msg,
                        "count":datasTwo.length,
                        "data":datasTwo
                    }
                },
                page: true,
                //一页选择显示5或10条数据
                limits: [5, 10]
            });

            form.on("submit(provinceSearch)",function (data) {
                vals=data.field.seName;
               /* //定义表单数据对象
                var formData=data.field;
                //得到表单数据json字符串
                var json=JSON.stringify(data.field);*/
                //alert(json);
                //重新加载表格对象
                tables.reload("secStockList");
                /*return false;*/
            });

        });
    </script>
</blockquote>
</body>
</html>